import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
import news from '@/views/modules/news/list'
import huodongbaoming from '@/views/modules/huodongbaoming/list'
import messages from '@/views/modules/messages/list'
import huodongxinxi from '@/views/modules/huodongxinxi/list'
import huodongxinde from '@/views/modules/huodongxinde/list'
import discusshuodongxinde from '@/views/modules/discusshuodongxinde/list'
import storeup from '@/views/modules/storeup/list'
import huodongtongzhi from '@/views/modules/huodongtongzhi/list'
import config from '@/views/modules/config/list'
import datastatistics from '@/views/modules/datastatistics/BarChartComponent'
import zhiyuanzhe from '@/views/modules/zhiyuanzhe/list'
import huodongleixing from '@/views/modules/huodongleixing/list'

Vue.use(VueRouter);


//2.配置路由   注意：名字
const routes = [{
    path: '/index',
    name: '首页',
    component: Index,
    children: [{
        // 这里不设置值，是把main作为默认页面
        path: '/',
        name: '首页',
        component: Home,
        meta: {icon: '', title: 'center'}
    }, {
        path: '/updatePassword',
        name: '修改密码',
        component: UpdatePassword,
        meta: {icon: '', title: 'updatePassword'}
    }, {
        path: '/pay',
        name: '支付',
        component: pay,
        meta: {icon: '', title: 'pay'}
    }, {
        path: '/center',
        name: '个人信息',
        component: center,
        meta: {icon: '', title: 'center'}
    }
        , {
            path: '/news',
            name: '公告信息',
            component: news
        }
        , {
            path: '/huodongbaoming',
            name: '活动报名',
            component: huodongbaoming
        }
        , {
            path: '/messages',
            name: '交流反馈',
            component: messages
        }
        , {
            path: '/huodongxinxi',
            name: '活动信息',
            component: huodongxinxi
        }
        , {
            path: '/huodongxinde',
            name: '活动心得',
            component: huodongxinde
        }
        , {
            path: '/discusshuodongxinde',
            name: '活动心得评论',
            component: discusshuodongxinde
        }
        , {
            path: '/storeup',
            name: '我的收藏管理',
            component: storeup
        }
        , {
            path: '/huodongtongzhi',
            name: '活动通知',
            component: huodongtongzhi
        }
        ,
        {
            path: '/config',
            name: '轮播图管理',
            component: config
        }, {
            path: '/datastatistics',
            name: '数据统计',
            component: datastatistics
        },
        {
            path: '/zhiyuanzhe',
            name: '志愿者',
            component: zhiyuanzhe
        }
        , {
            path: '/huodongleixing',
            name: '活动类型',
            component: huodongleixing
        }
    ]
},
    {
        path: '/login',
        name: 'login',
        component: Login,
        meta: {icon: '', title: 'login'}
    },
    {
        path: '/register',
        name: 'register',
        component: register,
        meta: {icon: '', title: 'register'}
    },
    {
        path: '/',
        name: '首页',
        redirect: '/index'
    }, /*默认跳转路由*/
    {
        path: '*',
        component: NotFound
    }
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
    mode: 'hash',
    /*hash模式改为history*/
    routes // （缩写）相当于 routes: routes
})

export default router;
